<?php
header("content-type:text/html;charset=utf-8");
include("../conn/conn.php");
$name=$_POST["name"];
$pass=$_POST["password"];
$type=$_POST["type"];
$guname=$_POST["guname"];
if($guname=="" || $name==""){
	echo("<script>alert('管理员需要输入姓名和账号');window.location.href='gly_add.php';</script>");
	}
$sql_pd="select * from tb_user where name='".$name."'";
$result_pd=mysqli_query($link,$sql_pd);
if(mysqli_num_rows($result_pd)>0){
	echo"此管理员账号已存在，请重新输入";
}
	else{
		$sql="insert into tb_guan(name,password,type,guname)values('".$name."','".$pass."','".$type."','".$guname."')";
		mysqli_query($link,$sql);
		echo("<script>alert('添加管理员成功');window.location.href='gly_gl.php';</script>");
	}
?>